<template>
  <el-tabs v-model="activeName" class="demo-tabs" @tab-change="handleClick">
    <el-tab-pane v-for="item in filterRoutes" :key="item.name" :label="item.meta.title" :name="item.path">
    </el-tab-pane>
  </el-tabs>
  <router-view />
</template>
<script setup>
import { ref, computed } from 'vue'
import { useRouter } from 'vue-router'
import { routes } from '@/router'
const router = useRouter()
const activeName = ref(routes[0].path)
const filterRoutes = computed(() => {
  return routes.filter(item => !!item.meta?.title)
})
// 路由跳转
const handleClick = (name) => {
  console.log(name)
  router.push(name)
}
</script>
<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
